﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Universal
{
   public class CommonMethod
    {
       /// <summary>
       /// 保存操作日志
       /// </summary>
       /// <param name="UserID"></param>
       /// <param name="strAction"></param>
       /// <param name="date"></param>
       public static void SaveOpreation(int UserID,string strAction,DateTime date)
       {
           strAction = strAction.Length > 500 ? (strAction.Substring(0, 490)+".....") : strAction;  //防止过长
           Model.SysManage.T_PUB_OPERATION operationModel = new Model.SysManage.T_PUB_OPERATION();
           operationModel.ACTION = strAction;
           operationModel.USER_ID = UserID;
           operationModel.TIME = date;
           BLL.SysManage.T_PUB_OPERATION opertionBll = new BLL.SysManage.T_PUB_OPERATION();
           opertionBll.Add(operationModel);
       }
       /// <summary>
       /// 判断角色是否查看所有分店信息
       /// </summary>
       /// <returns></returns>
       public static bool checkRole(List<Model.SysManage.T_PUB_USERROLE> modelList)
       {

           return modelList.Exists(n => n.ROLE_ID == 1);
            
       }

       public static bool CheckUser(string strUserName, string strPassWord)
       {
             bool falg = false;
             BLL.SysManage.T_PUB_USER userBll = new BLL.SysManage.T_PUB_USER();
             Model.SysManage.T_PUB_USER userModel;
             userModel = userBll.GetModelByUserSymbol(strUserName);

            if (userModel != null && userModel.PASSWORD.Equals(strPassWord) && userModel.ISUSED != false)
            {
                falg = true;
            }
            return falg;
       }
    }
}
